// 导入 ejs 模块
const ejs = require("ejs");
const fs = require("fs");
const path = require("path");

// 读取文件内容
const data = fs.readFileSync(path.resolve(__dirname, "xiyou.html"), "utf8");
console.log(data.toString());

let xiyou = ["唐僧", "孙悟空", "猪八戒", "沙僧"];
xiyou.forEach((item) => {
  console.log(item);
});

let rlt = ejs.render(data.toString(), { xiyou: xiyou });
console.log(rlt);
